package com.xinxin.intelligenceexam.studyMenu.popMenu;


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.xinxin.intelligenceexam.R;
import com.xinxin.intelligenceexam.utils.ToastUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PopMenuActivity extends AppCompatActivity {

    @BindView(R.id.toolbar_popMenu)
    Toolbar mToolbarPopMenu;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pop_menu);
        ButterKnife.bind(this);
        setSupportActionBar(mToolbarPopMenu);
        mToolbarPopMenu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popMenu();
            }
        });
    }

    private void popMenu() {
        SHContextMenu shContextMenu = new SHContextMenu(PopMenuActivity.this);
        List<ContextMenuItem> itemList = new ArrayList<>();
        itemList.add(new ContextMenuItem(getResources().getDrawable(R.drawable.ic_menu_chat), "草稿", true, "#FFFFFF"));
        itemList.add(new ContextMenuItem(getResources().getDrawable(R.drawable.ic_menu_chat), "草稿", true, "#FFFFFF"));
        itemList.add(new ContextMenuItem(getResources().getDrawable(R.drawable.ic_menu_chat), "草稿", true, "#FFFFFF"));
        itemList.add(new ContextMenuItem(getResources().getDrawable(R.drawable.ic_menu_chat), "草稿", true, "#FFFFFF"));
        itemList.add(new ContextMenuItem(getResources().getDrawable(R.drawable.ic_menu_chat), "草稿", true, "#FFFFFF"));
        shContextMenu.setItemList(itemList);
        shContextMenu.setOnItemSelectListener(new SHContextMenu.OnItemSelectListener() {
            @Override
            public void onItemSelect(int position) {
                ToastUtils.showShort(position + "");
            }
        });
        shContextMenu.showMenu();
    }
}
